from django.conf.urls import patterns, include, url
from django.conf import settings

# Uncomment the next two lines to enable the admin:
from django.contrib import admin

from mezzanine.core.views import direct_to_template

admin.autodiscover()

urlpatterns = patterns('',
                       # Examples:
                       # url(r'^$', 'django_cms_article.views.home', name='home'),
                       # url(r'^django_cms_article/', include('django_cms_article.foo.urls')),

                       # Uncomment the admin/doc line below to enable admin documentation:
                       url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

                       # Uncomment the next line to enable the admin:
                       url(r'^admin/', include(admin.site.urls)),

                       url(r'^article/', include('article.urls')),

                       url("^$", direct_to_template, {"template": "index.html"}, name="home"),

                       # HOMEPAGE AS AN EDITABLE PAGE IN THE PAGE TREE
                       # ---------------------------------------------
                       # This pattern gives us a normal ``Page`` object, so that your
                       # homepage can be managed via the page tree in the admin. If you
                       # use this pattern, you'll need to create a page in the page tree,
                       # and specify its URL (in the Meta Data section) as "/", which
                       # is the value used below in the ``{"slug": "/"}`` part.
                       # Also note that the normal rule of adding a custom
                       # template per page with the template name using the page's slug
                       # doesn't apply here, since we can't have a template called
                       # "/.html" - so for this case, the template "pages/index.html"
                       # should be used if you want to customize the homepage's template.

                       # url("^$", "mezzanine.pages.views.page", {"slug": "/"}, name="home"),

                       # HOMEPAGE FOR A BLOG-ONLY SITE
                       # -----------------------------
                       # This pattern points the homepage to the blog post listing page,
                       # and is useful for sites that are primarily blogs. If you use this
                       # pattern, you'll also need to set BLOG_SLUG = "" in your
                       # ``settings.py`` module, and delete the blog page object from the
                       # page tree in the admin if it was installed.

                       # url("^$", "mezzanine.blog.views.blog_post_list", name="home"),

                       # MEZZANINE'S URLS
                       # ----------------
                       # ADD YOUR OWN URLPATTERNS *ABOVE* THE LINE BELOW.
                       # ``mezzanine.urls`` INCLUDES A *CATCH ALL* PATTERN
                       # FOR PAGES, SO URLPATTERNS ADDED BELOW ``mezzanine.urls``
                       # WILL NEVER BE MATCHED!

                       # If you'd like more granular control over the patterns in
                       # ``mezzanine.urls``, go right ahead and take the parts you want
                       # from it, and use them directly below instead of using
                       # ``mezzanine.urls``.
                       ("^", include("mezzanine.urls")),

)

if settings.DEBUG:
    urlpatterns = patterns('',
                           url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
                               {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
                           url(r'', include('django.contrib.staticfiles.urls')),
    ) + urlpatterns